package com.sdk.bigdata.model;

public class DataResponse extends BaseResponse {

    private Integer errCode;

    private String errMessage;

    private boolean isSuccess;

    public Integer getErrCode() {
        return errCode;
    }

    public void setErrCode(Integer errCode) {
        this.errCode = errCode;
    }

    public String getErrMessage() {
        return errMessage;
    }

    public void setErrMessage(String errMessage) {
        this.errMessage = errMessage;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }

    public static DataResponse fail(Integer errCode, String errMessage) {
        DataResponse dataResponse = new DataResponse();
        dataResponse.setErrCode(errCode);
        dataResponse.setErrMessage(errMessage);
        dataResponse.setSuccess(false);
        return dataResponse;
    }

    public static DataResponse success() {
        DataResponse dataResponse = new DataResponse();
        dataResponse.setCode(0);
        dataResponse.setMessage("数据已经接收成功");
        dataResponse.setSuccess(true);
        return dataResponse;
    }

    @Override
    public String toString() {
        return "DataResponse{" +
                "code = " + this.getCode() +
                ",message = " + this.getMessage() +
                ",errCode=" + errCode +
                ", errMessage='" + errMessage + '\'' +
                ", isSuccess=" + isSuccess +
                '}';
    }
}
